home *** CD-ROM | disk | FTP | other *** search
- Path: news.onramp.net!usenet
- From: purple@haze.net
- Newsgroups: comp.lang.c
- Subject: Re: Problem with c code, please help!
- Date: Mon, 22 Jan 1996 09:25:57 GMT
- Organization: On-Ramp; Individual Internet Connections; Dallas/Ft Worth/Houston, TX USA
- Message-ID: <4dvfa4$lfg@news.onramp.net>
- References: <surgsw-1901960148530001@128.206.206.86>
- NNTP-Posting-Host: stemmons15.onramp.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- surgsw@mizzou1.missouri.edu (Joel Weinstein) wrote:
-
- >I have been trying to get this very simple piece of code to work for
- >hours. What is the problem???????
-
- >#include <stdio.h>
-
- >main()
- >{
- > int i=0;
- > char word[100], c;
- > printf("Enter a word: ");
- > while( (c = getchar()) != '\n') {
- > *word = c;
- > word == word + 1;
- > }
- > printf("You entered: ");
- > *word = 0;
- > while( *word != '\n' )
- > {
- > putchar( *word );
- > word == word + 1;
- > }
- >}
-
- >I think the problem I am having is due to my not knowing when to use the
- >'*' operator. When do you use it? Also, why won't my goddam compiler let
- >me do word++; instead of word == word +1; I also tried to do *word++;
- >and it didn't work, what is the deal with that. It won't let me put word
- >= word + 1;. It insists on the double ='s. Why is that?
-
- >Please send e-mail.
-
- >Joel
-
- >ps: is there a way to find out what exactly error messages mean? I kept
- >getting something similar to: not an Ivalue. It would be nice if I knew
- >what the hell that meant.
-
-
- word == word + 1; dosn;t do anything
- word = word + 1; or word++;
- You will also have to restore word to the original base pointer
- between getting and printing word
-
-
-